/* ----------------------------------------------------------------------
 *	Shadow Quest
 *	Copyright (C) 2009 Prageeth Silva <prageeth@thenewcoders.com>
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  ----------------------------------------------------------------------
 */

package sq;

import java.lang.reflect.Field;
import org.newdawn.slick.SlickException;

public class EntryClass 
{

	/** Entry point for the JVM.
	 * Adds the native libraries to the java.library.path before instantiating the RPG.
	 */
	public static void main(String[] args)
	{
		
		// set the library path
                // choose the appropriate platform (directory under "native").
		System.setProperty("java.library.path", "lib/native/linux");
		// TODO
		java.io.File file = new java.io.File("new.txt");
		System.out.println(file.getAbsolutePath());
		try
		{
			// make the system path null to override the java specified library path
			Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths");
			fieldSysPath.setAccessible(true);
			if (fieldSysPath != null)
			{
				fieldSysPath.set(System.class.getClassLoader(), null);
			}
			// load the RPG
			RPG.main(args);
		} 
		catch (SecurityException e) 
		{
			//e.printStackTrace();
		} 
		catch (NoSuchFieldException e)
		{
			//e.printStackTrace();
		} 
		catch (IllegalArgumentException e)
		{
			//e.printStackTrace();
		} 
		catch (IllegalAccessException e) 
		{
			//e.printStackTrace();
		} 
		catch (SlickException e) 
		{
			//e.printStackTrace();
		}
			
	}

}
